﻿using System.Drawing;

namespace ConsoleGame
{
    internal class Program
    {/// <summary>
     /// 移动小游戏
     /// </summary>
     /// <param name="args"></param>
        static void Main(string[] args)
        {   //定义整型初始点x，y


            int x = 0, y = 0;
            //在（x,y）输出hello
            ConsoleKey input;
            do
            {
                Console.Clear();
                Console.SetCursorPosition(x, y);
                Console.Write("Hello");
                //接受用户输入
                input = Console.ReadKey(true).Key;
                //根据用户输入调整xy

                switch (input)
                {
                    case ConsoleKey.A:
                        if (x > 0) x--;
                        break;
                    case ConsoleKey.S:
                        if (y < 80) y++;
                        break;
                    case ConsoleKey.D:
                        if (x < 80) x++;
                        break;
                    case ConsoleKey.W:
                        if (y > 0) y--;
                        break;
                    default: break;
                }
                //回到第二步

            }
            while (input != ConsoleKey.Enter);

        }
    }
}





